package com.zdj.presentation.modules.im.vms;

import android.databinding.ObservableField;

import com.zdj.presentation.base.BaseActivity;
import com.zdj.presentation.base.BaseViewModel;
import com.zdj.presentation.modules.im.adapters.ChatAdapter;
import com.zdj.presentation.modules.im.models.ChatModel;
import com.zdj.presentation.modules.im.views.ChatActivity;
import com.zdj.presentation.modules.user.adapters.UserAdapter;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by zdj on 16-7-9.
 */

public class ChatVm extends BaseViewModel<ChatActivity> {

    public final ObservableField<ChatAdapter> chatAdapterObservableField = new ObservableField<>();

    ChatAdapter chatAdapter;

    public ChatVm(ChatActivity chatActivity) {
        super(chatActivity);
        chatAdapter = new ChatAdapter(t);
        chatAdapterObservableField.set(chatAdapter);
    }

    @Command
    public void loadChatList(){
        List<ChatModel> chatModels = new ArrayList<>();
        for (int i = 0; i < 20 ; i++){
            ChatModel chatModel = new ChatModel();

            if (i % 2 == 0) {
                chatModel.content = "白富美";
                chatModel.isComMsg = true;
            } else {
                chatModel.content = "高富帅";
                chatModel.isComMsg = false;
            }
            chatModels.add(chatModel);
        }
        chatAdapter.addAll(chatModels);
    }



}
